import React from 'react'
import { BrowserRouter, Routes, Route ,createBrowserRouter, RouterProvider,useNavigate} from 'react-router-dom'   
import Home from './Pages/Home'
import About from './Pages/About'
import Layout from './Pages/Layout'
import KeepAlive from './KeepAlive'
const routes = [
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/home',
        element: <Home />,
      },
      {
        path: '/about',
        element: <About />,
      }
    ]
  }
]
const router=createBrowserRouter(routes)
export default function App() {
  return (
    <div>
      <KeepAlive keepPath={['/home']}>
        <RouterProvider  router={router} />
      </KeepAlive>
    </div>  
  )
}
